#预期交互登录
#!/bin/bash
user=root
pass=123456
ip=192.168.1.120
expect << EOF
set timeout 30
spawn ssh $user@$ip
expect {
	"(yes/no)" {send "yes\r"; exp_continue}
	"password:" {send "$pass\r"}
}
expect "$user@*" {send "$1\r"}
expect "$user@* {send "exit\r"}"
expect eof
EOF

